package cn.yueranzs.login.service.impl;

import org.springframework.security.authentication.AuthenticationDetailsSource;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * 描述：自定义AuthenticationDetailsSource，将HttpServletRequest注入到LoginWebAuthenticationDetails，使其能获取到请求中的验证码等其他信息
 * @author yueranzs
 * @date 2021/12/1 9:42
 */
@Component
public class LoginAuthenticationDetailsSource implements AuthenticationDetailsSource<HttpServletRequest, WebAuthenticationDetails> {
    @Override
    public WebAuthenticationDetails buildDetails(HttpServletRequest request) {
        return new LoginWebAuthenticationDetails(request);
    }
}
